package net.zjitc.dao.Impl;

import net.zjitc.dao.AdminDao;
import net.zjitc.pojo.Adminuser;
import net.zjitc.utils.db.C3P0Utils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.sql.SQLException;
import java.util.List;

/**
 * Created by dell on 2017/11/18.
 */
public class AdminDaoImpl implements AdminDao {
    QueryRunner runner=new QueryRunner(C3P0Utils.getDataSource());
    public List<Adminuser> findAllAdminuser() {
        String sql="select * from adminuser";
        try {
            List<Adminuser> list= (List<Adminuser>) runner.query(sql,new BeanListHandler(Adminuser.class));
            return list;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
